import java.util.Scanner;
public class digui{
  public int getFac(int m){
     if(m==1){
     return 1;
  }else{
      return m * getFac(m-1);
     }}
    public static void main (String args[]){
      digui fac = new digui();
      int sum=0;
    System.out.println("输入n的值:");
    Scanner n=new Scanner(System.in).nextInt();
   for(int i=1;i<=n;i++){
     sum+=fac.getFac(i);
    }
    System.out.println("1到"+n+"的阶乘的和是:"+sum);
}}
